// 科技系统类型定义

import type { ResourceCost } from './resources'
import type { UnlockCondition, Effect } from './game'

export interface Technology {
  id: string
  name: string
  description: string
  branch: TechBranch
  tier: TechTier
  researchCost: ResourceCost[]
  researchTime: number
  prerequisites: string[]
  effects: TechEffect[]
  unlocks: string[]
  icon: string
  isResearched: boolean
  researchProgress: number
}

export type TechBranch = 'basic' | 'energy' | 'industrial' | 'military' | 'exploration' | 'biological' | 'advanced'

export type TechTier = 1 | 2 | 3 | 4 | 5

export interface TechEffect extends Effect {
  technologyId: string
  description: string
}

export interface ResearchProject {
  technologyId: string
  startTime: number
  totalTime: number
  progress: number
  researchersAssigned: number
  efficiency: number
}

export interface TechTree {
  branches: TechBranch[]
  technologies: Technology[]
  connections: TechConnection[]
}

export interface TechConnection {
  from: string
  to: string
  type: 'prerequisite' | 'unlocks' | 'synergy'
}

export interface ResearchFacility {
  id: string
  name: string
  researchSpeed: number
  specialization: TechBranch[]
  capacity: number
  efficiency: number
}

// 科技ID常量
export const BASIC_TECH = {
  BASIC_ENGINEERING: 'basic_engineering',
  MATERIALS_SCIENCE: 'materials_science',
  COMPUTER_SCIENCE: 'computer_science',
  PHYSICS: 'physics',
  CHEMISTRY: 'chemistry'
} as const

export const ENERGY_TECH = {
  SOLAR_POWER: 'solar_power',
  NUCLEAR_FISSION: 'nuclear_fission',
  NUCLEAR_FUSION: 'nuclear_fusion',
  ANTIMATTER_POWER: 'antimatter_power',
  ZERO_POINT_ENERGY: 'zero_point_energy'
} as const

export const INDUSTRIAL_TECH = {
  AUTOMATION: 'automation',
  ROBOTICS: 'robotics',
  NANOTECHNOLOGY: 'nanotechnology',
  MOLECULAR_ASSEMBLY: 'molecular_assembly',
  MATTER_CONVERSION: 'matter_conversion'
} as const

export const MILITARY_TECH = {
  KINETIC_WEAPONS: 'kinetic_weapons',
  ENERGY_WEAPONS: 'energy_weapons',
  PLASMA_WEAPONS: 'plasma_weapons',
  PARTICLE_WEAPONS: 'particle_weapons',
  REALITY_WEAPONS: 'reality_weapons'
} as const

export const EXPLORATION_TECH = {
  CHEMICAL_PROPULSION: 'chemical_propulsion',
  ION_DRIVE: 'ion_drive',
  WARP_DRIVE: 'warp_drive',
  JUMP_DRIVE: 'jump_drive',
  DIMENSIONAL_TRAVEL: 'dimensional_travel'
} as const

export const BIOLOGICAL_TECH = {
  GENETIC_ENGINEERING: 'genetic_engineering',
  LIFE_EXTENSION: 'life_extension',
  CONSCIOUSNESS_TRANSFER: 'consciousness_transfer',
  SYNTHETIC_BIOLOGY: 'synthetic_biology',
  TRANSCENDENCE: 'transcendence'
} as const

export const ADVANCED_TECH = {
  QUANTUM_COMPUTING: 'quantum_computing',
  TEMPORAL_MECHANICS: 'temporal_mechanics',
  DIMENSIONAL_PHYSICS: 'dimensional_physics',
  REALITY_MANIPULATION: 'reality_manipulation',
  COSMIC_ENGINEERING: 'cosmic_engineering'
} as const